package com.east.sng.entity.param;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;

/**
 * @author east
 * @date: 2021/12/27
 * @Description: user update password receive param javabean
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserPassword {

    /**
     * 原密码
     */
    @NotBlank(message = "{user.initpassword.notblank}")
    @Length(min = 6,message = "{user.userpassword.length}")
    private String initPassword;
    /**
     * 新密码
     */
    @NotBlank(message = "{user.newpassword.notblank}")
    @Length(min = 6,message = "{user.userpassword.length}")
    private String newPassword;
    /**
     * 确认密码
     */
    @NotBlank(message = "{user.confirmpassword.notblank}")
    @Length(min = 6,message = "{user.userpassword.length}")
    private String confirmPassword;

    public boolean compareNewPassword(){
        return this.newPassword.equals(this.initPassword);
    }

    public boolean compareConfirmPassword(){
        return this.confirmPassword.equals(this.newPassword);
    }

}
